home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
COMPNENT
/
SAWIN95
/
SAWIN95.ZIP
/
Lib
/
32
/
FreeWare
/
NonVis.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-10-22
|
1KB
|
64 lines
unit NonVis;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms;
type
TWindowedComponent = class(TComponent)
private
FHandle : THandle;
function GetHandle: THandle;
{ Private declarations }
protected
procedure WndProc(var Msg : TMessage); virtual;
{ Protected declarations }
public
function HandleAllocated: Boolean;
procedure HandleNeeded;
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
property Handle: THandle read GetHandle;
end;
implementation
{ TWindowedComponent }
constructor TWindowedComponent.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
FHandle := 0;
end;
destructor TWindowedComponent.Destroy;
begin
if HandleAllocated then DeAllocateHWnd(FHandle);
inherited Destroy;
end;
function TWindowedComponent.HandleAllocated: Boolean;
begin
Result := FHandle<>0;
end;
procedure TWindowedComponent.HandleNeeded;
begin
if not HandleAllocated then FHandle := AllocateHWnd(WndProc);
end;
function TWindowedComponent.GetHandle: THandle;
begin
HandleNeeded;
Result := FHandle;
end;
procedure TWindowedComponent.WndProc(var Msg : TMessage);
begin
Dispatch(Msg);
end;
end.